from tests.pytests.helpers.codegen_helpers import compile_chunk, assert_code_contains


def test_unary_ops():
    def f(a: int, b: bool) -> int:
        if not b:
            return -a
        return a

    block = compile_chunk(f)
    assert_code_contains(
        block,
        """
        int f(int a, bool b) {
            if (!b) {
                return -a;
            }
            return a;
        }
        """,
    )
